All Questions
98 questions
0votes
0answers
98views
By creating an architecture, it is better to have many classes that handles different scenarios, or a single one that handles all? [duplicate]
During my limited professional experience, I have been involved in microservices projects with a common structure: The Controller takes a request and validates it using the jakarta.validation....
0votes
1answer
1kviews
Pattern to convert different types of similar unchangeable objects to the same object
I have an existing system that inserts books into a library database, and I want to generalize it to include other media. The other media is similar, but not exactly the same, and all media are third ...
-1votes
2answers
336views
Implementation of method differs only in one line
I have 2 implementation of the interface: public interface MyInterface{ void getCollectedData(MyData mydata); } public class MyImpl implements MyInterface{ public void getCollectedData(MyData ...
1vote
2answers
385views
Are experienced developers and software architects able to describe an entire software application in terms of design patterns?
Do experienced developers and software architects see entire application in terms of design patterns? In other words experienced developers and software architects able to describe an entire software ...
8votes
5answers
4kviews
Interface implementation where one method body remains empty
I have producers that take data A, produce data B and send it public interface Producer<T>{ void produce(T data); void flush(); } public class DataBaseProducer ...
2votes
1answer
334views
Composition or Inheritance for classes with almost similar implementations but different input and outputs for methods?
I have the following classes, which have quite similar method implementations. Only the classes' method inputs and outputs seem to be of different types. When I put it like this, it sounds like a case ...
4votes
3answers
4kviews
What about Utility-Classes, but without hard dependencies?
The average utility class: A stateless class that provides some functionality by exposing static methods. Its default constructor is private to avoid instantiation. When ever the average utility class ...
1vote
2answers
122views
Designing UI module for an application
I have an UI module that will expose only one class - UserInterface. The class will be responsible for collecting user input and providing output (command line UI style). From logical way of thinking, ...
-1votes
1answer
293views
Loose coupling with inner classes
I just have a quick question as I couldn't find any concrete answers on the web. Does having a private static inner class promote loose or tight coupling between it and the outer class in Java? Thanks ...
3votes
4answers
2kviews
De-coupling business logic from POJO de-serialization design pattern
I've a JSON file which I'm trying to de-serialize into POJOs. public abstract BaseClass { private String baseClassField; abstract String execute(); } ClassA extends BaseClass public ClassA ...
1vote
2answers
253views
design problem handling a dynamic object
I am writing an application for different geometrical types of fuel tanks. I have a design problem that only at runtime I will receive the exact type of tank from the end user; and I don't know how ...
1vote
0answers
59views
How does a framework manager, broker or coordinator class handle pluggable extensions and make them run?
I'm trying to understand if there is a manager/broker/coordinator class in frameworks and I hope so, but what possible ways are in a framework to make it run the pluggable extensions and what the term ...
1vote
1answer
355views
Is designing a generic parameterized class with methods of it accepting higher order functions a functional technique that we can use in Java 8?
Recently I have asked this question: How do you rewrite the code which using generics and functionals in Java 8 and mixing oop and functional programming by using only object-oriented? on ...
-5votes
1answer
81views
How to organize the following code in a better way? [closed]
I've a class which performs an operation (say A). I've few logic which has to happen before A happens and few during A happens and few after A has happened. interface ILaunchInterface { public ...
0votes
1answer
806views
How To Design Event Handlers With Different Parameters
I have an interface Event and a class Agent. I want to be able to write something like agent.handle(event). However, the classes that implement the event interface will all have different fields ...